package org.NooLab.itexx.app.gui.handlers;

import org.NooLab.itexx.ITexxWindowCommons;
import org.NooLab.itexx.app.controller.ItexxModelController;
import org.NooLab.itexx.app.gui.definition.ITexxWindowGui2;

public class StatusBarButtonHandler {

	
	ITexxWindowGui2 windowGui;
	private ITexxWindowCommons appCommons;
	private ItexxModelController modelController;
	
	
	public StatusBarButtonHandler( ITexxWindowGui2 gui, 
								   int actionIndex,
								   String atext, int activePanel) {
		// 
		windowGui = gui;
		appCommons = windowGui.getAppCommons();
		modelController = appCommons.getModelController() ;
		
		handlingClick(actionIndex);
	}


	private void handlingClick(int aix) {
		// 
		if (aix == 0){
			// show info page
			appCommons.showInfo(0);
		}
		
		if (aix == -3){
			// clear list
			modelController.clearPanelList(0); // 0=remaining
		}
		if (aix == 10){
			// full window
			windowGui.getWindowAppearance().toggleSimpleView(101);
			
		}
		if (aix == 11){
			// simple window
			windowGui.getWindowAppearance().prepareSimpleView(1);
			windowGui.getWindowAppearance().toggleSimpleView(99);
		}
		if (aix == 15){
			// pause
			modelController.setResponsiveness(0);
		}
		if (aix == 16){
			// activate
			modelController.setResponsiveness(1);
		}
		if (aix == 20){
			// search
		}
		if (aix == 90){
			// click to wait button == interrupt all processes
			modelController.setUserBreak(true);
		}
		if (aix == 99){
			// exit
		
			appCommons.getApp().close();
		}
		
	}

	
}
